home *** CD-ROM | disk | FTP | other *** search
/ Trusted Irix /B 4.0.4 / Trusted-Irix B-4.0.1.iso / dist / eoe1.idb / usr / include / sys / shm.h.z / shm.h
C/C++ Source or Header  |  1992-04-03  |  3KB  |  122 lines

  1. #ifndef __SYS_SHM_H__
  2. #define __SYS_SHM_H__
  3.  
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7.  
  8. /**************************************************************************
  9.  *                                      *
  10.  *          Copyright (C) 1990, Silicon Graphics, Inc.          *
  11.  *                                      *
  12.  *  These coded instructions, statements, and computer programs  contain  *
  13.  *  unpublished  proprietary  information of Silicon Graphics, Inc., and  *
  14.  *  are protected by Federal copyright law.  They  may  not be disclosed  *
  15.  *  to  third  parties  or copied or duplicated in any form, in whole or  *
  16.  *  in part, without the prior written consent of Silicon Graphics, Inc.  *
  17.  *                                      *
  18.  **************************************************************************/
  19. /*    Copyright (c) 1984 AT&T    */
  20. /*      All Rights Reserved      */
  21.  
  22. /*    THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T    */
  23. /*    The copyright notice above does not evidence any       */
  24. /*    actual or intended publication of such source code.    */
  25.  
  26. #ident    "$Revision: 3.14 $"
  27.  
  28. /*
  29. **    IPC Shared Memory Facility.
  30. */
  31.  
  32. /*
  33. **    Implementation Constants.
  34. */
  35.  
  36. #define    SHMLBA    stob(1)    /* segment low boundary address multiple */
  37.             /* (SHMLBA must be a power of 2) */
  38.  
  39. /*
  40. **    Permission Definitions.
  41. */
  42.  
  43. #define    SHM_R    0400    /* read permission */
  44. #define    SHM_W    0200    /* write permission */
  45.  
  46. /*
  47. **    ipc_perm Mode Definitions.
  48. */
  49.  
  50. #define    SHM_INIT    01000    /* grow segment on next attach */
  51. #define    SHM_DEST    02000    /* destroy segment when # attached = 0 */
  52.  
  53. /*
  54. **    Message Operation Flags.
  55. */
  56.  
  57. #define    SHM_RDONLY    010000    /* attach read-only (else read-write) */
  58. #define    SHM_RND        020000    /* round attach address to SHMLBA */
  59.  
  60. /*
  61. **    Structure Definitions.
  62. */
  63.  
  64. /*
  65. **    There is a shared mem id data structure for each segment in the system.
  66. */
  67.  
  68. struct shmid_ds {
  69.     struct ipc_perm    shm_perm;    /* operation permission struct */
  70.     int        shm_segsz;    /* size of segment in bytes */
  71.     struct region    *shm_reg;    /* ptr to region structure */
  72.     char        pad[4];        /* for swap compatibility */
  73.     ushort        shm_lpid;    /* pid of last shmop */
  74.     ushort        shm_cpid;    /* pid of creator */
  75.     ushort        shm_nattch;    /* used only for shminfo */
  76.     ushort        shm_cnattch;    /* used only for shminfo */
  77.     time_t        shm_atime;    /* last shmat time */
  78.     time_t        shm_dtime;    /* last shmdt time */
  79.     time_t        shm_ctime;    /* last change time */
  80. };
  81.  
  82. struct    shminfo {
  83.     int    shmmax,        /* max shared memory segment size */
  84.         shmmin,        /* min shared memory segment size */
  85.         shmmni,        /* # of shared memory identifiers */
  86.         shmseg,        /* max attached shared memory      */
  87.                 /* segments per process          */
  88.         shmall;        /* max total shared memory system */
  89.                 /* wide (in clicks)          */
  90. };
  91.  
  92.  
  93. /*
  94.  * Shared memory control operations
  95.  */
  96.  
  97. #define SHM_LOCK    3    /* Lock segment in core */
  98. #define SHM_UNLOCK    4    /* Unlock segment */
  99.  
  100. #ifdef _KERNEL
  101. /*
  102.  * Macro to generate shmid header lockptr
  103.  */
  104.  
  105. #define    SHMADDR(X)    &shmsem[X]
  106. #endif /* _KERNEL */
  107.  
  108. #ifndef _KERNEL
  109.  
  110. extern void    *shmat(int, void *, int);
  111. extern int    shmdt(void *);
  112. extern int     shmctl(int, int, ...);
  113. extern int    shmget(key_t, int, int);
  114.  
  115. #endif /* !_KERNEL */
  116.  
  117. #ifdef __cplusplus
  118. }
  119. #endif
  120.  
  121. #endif /* !__SYS_SHM_H__ */
  122.